// reader.c
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>

#define BUFFER_SIZE 100

int main() {
    int fd;
    char * my_fifo = "/tmp/my_fifo";

    /* 打开FIFO进行读取 */
    fd = open(my_fifo, O_RDONLY);

    /* 读取数据 */
    char buffer[BUFFER_SIZE];
    read(fd, buffer, BUFFER_SIZE);
    printf("读取到的数据: %s\n", buffer);

    /* 关闭FIFO */
    close(fd);

    return 0;
}
